<template>
  <div class="index">
    <!-- 主体内容 -->
    <div class="main">
      <!-- 轮播图 -->
      <van-swipe :autoplay="3000">
        <van-swipe-item v-for="(image, index) in images" :key="index">
          <img :src="image.img" />
        </van-swipe-item>
      </van-swipe>

      <!-- 功能菜单 -->
      <van-row type="flex" justify="space-around">
        <van-col span="6" @click="$router.push('/home/newList')"
          ><van-image
            fit="cover"
            round
            width="100%"
            height="100%"
            :src="require('@/assets/menu3.png')"
          />
          <span>图文资讯</span>
        </van-col>
        <van-col span="6" @click="$router.push('/home/article')"
          ><van-image
            fit="cover"
            round
            width="100%"
            height="100%"
            :src="require('@/assets/menu4.png')"
          />
          <span>图片分享</span>
        </van-col>
        <van-col span="6" @click="$router.push('/home/produceList')"
          ><van-image
            fit="cover"
            round
            width="100%"
            height="100%"
            :src="require('@/assets/menu5.png')"
          />
          <span>商品展示</span>
        </van-col>
      </van-row>
      <van-row type="flex" justify="space-around">
        <van-col span="6"
          ><van-image
            fit="cover"
            round
            width="100%"
            height="100%"
            :src="require('@/assets/menu6.png')"
          />
          <span>留言反馈</span>
        </van-col>
        <van-col span="6"
          ><van-image
            fit="cover"
            round
            width="100%"
            height="100%"
            :src="require('@/assets/menu9.png')"
          />
          <span>搜索资讯</span>
        </van-col>
        <van-col span="6"
          ><van-image
            fit="cover"
            round
            width="100%"
            height="100%"
            :src="require('@/assets/loading.png')"
          />
          <span>联系我们</span>
        </van-col>
      </van-row>
    </div>
    <!-- 主体内容结束 -->
  </div>
</template>

<script>
import { getLunbo } from "@/apis/home.js";
export default {
  data() {
    return {
      // 轮播图图片存放路径
      images: [], //{img:'**',url:'**'}
    };
  },
  async created() {
    // 获取轮播图的图片：
    // getLunbo().then(res=>{console.log(res);})
    this.images = (await getLunbo()).data.message;
    // console.log("this.images", this.images);
  },
};
</script>

<style lang="less" scoped>
.main {
  margin-top: 5px;
  .van-swipe-item {
    img {
      width: 100%;
      height: 50%;
    }
  }
  .van-row {
    height: 90px;
    margin-top: 20px;
    .van-col {
      width: 60px;
      height: 80px;
      display: flex;
      justify-content: space-evenly;
      flex-direction: column;
      justify-content: center;
      align-items: center;
    }
    span {
      font-size: 15px;
      //   color: red;
    }
  }
}
</style>
